home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / STEP-1.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  1KB  |  38 lines

  1. ' STEP-1.BAS
  2. ' This program uses the illusion of zooming through space
  3. '   to demonstrate the STEP keyword.
  4.  
  5. CLS
  6.  
  7. CONST DELAY% = 200                  ' controls how fast stars "shoot"
  8.  
  9. INPUT "Please enter a screen mode (0-13):  ", modeNum%
  10. SCREEN modeNum%
  11.  
  12. DO
  13.     PSET (160, 100), 0              ' set center (assumes 320 by 200
  14.                                     '   resolution)
  15.     quad% = INT(RND(1) * 4)         ' random number for quadrant from
  16.                                     '   which the "star" will shoot
  17.     randX% = INT(RND(1) * 10)       ' random number for column movement
  18.     randY% = INT(RND(1) * 10)       ' random number for row movement
  19.  
  20.     IF quad% = 0 OR quad% = 1 THEN  ' normal movement is down;
  21.         randY% = -randY%            '   reverse y value to move up
  22.     END IF
  23.     IF quad% = 0 OR quad% = 3 THEN  ' normal movement is to right;
  24.         randX% = -randX%            '   reverse x value to move to left
  25.     END IF
  26.    
  27.     FOR i% = 1 TO 20
  28.         PSET STEP(-randX% * i%, randY% * i%)  ' draw "star"
  29.        
  30.         FOR j% = 1 TO DELAY%        ' delay loop
  31.         NEXT j%
  32.        
  33.         PRESET STEP(0, 0)           ' erase "star"
  34.     NEXT i%
  35.  
  36. LOOP UNTIL INKEY$ <> ""
  37.  
  38.